package xcu.lxj.nettychat.user.domain.vo.response.friend;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xcu.lxj.nettychat.user.domain.entity.User;

import java.io.Serializable;
import java.util.Date;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Schema(name = "好友校验")
public class FriendApplyResp {

    @Schema(description = "申请id")
    private Long applyId;

    private UserInfo userInfo =  new UserInfo();
    @Data
    @Schema(name = "发送者信息")
    @NoArgsConstructor
    public static class UserInfo implements Serializable {
        @Schema(description = "uid")
        private Long uid;
        private String name;
        private String avatar;
        private int sex;
    }

    public void initUserInfo(User user){
        this.userInfo.uid = user.getId();
        this.userInfo.name = user.getName();
        this.userInfo.avatar = user.getAvatar();
        this.userInfo.sex = user.getSex();
    }


    @Schema(description = "申请人uid")
    private Long uid;

    @Schema(description = "申请类型 1加好友")
    private Integer type;

    @Schema(description = "申请信息")
    private String msg;

    @Schema(description = "申请状态 1待审批 2同意")
    private Integer status;

    @Schema(description = "修改时间")
    private Date updateTime;

    @Schema(description = "创建时间")
    private Date createTime;
}
